package com.buaa.service.impl;

import com.buaa.model.solr.Paper;
import com.buaa.repository.solr.PaperSolrRepository;
import com.buaa.service.PaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by DELL on 2018/4/9.
 */
@Service
public class PaperServiceImpl implements PaperService {

    @Autowired
    PaperSolrRepository paperSolrRepository;

    @Override
    public List<Paper> findPaperListByAuthor(String author,int begin,int size) {
        PageRequest pageRequest = new PageRequest(begin,size);
        return paperSolrRepository.findPaperListByAuthor(author,pageRequest);
    }

    @Override
    public List<Paper> findPaperListByAuthorAndOrg(String author, String organization,int begin,int size) {
        PageRequest pageRequest = new PageRequest(begin,size);
        return paperSolrRepository.findPaperListByAuthorAndOrg(author,organization,pageRequest);
    }

    @Override
    public List<Paper> findPaperListByKeyword(String keyword, int begin, int size) {
        PageRequest pageRequest = new PageRequest(begin,size);
        return paperSolrRepository.findPaperListByKeyword(keyword,pageRequest);
    }
}
